<?php
namespace VSTpl;
  
    function tag_active($params)
    {
        $active_class = 'active';
        if(isset($params['class'])){
            $active_class = $params['class'];
        }
        if(isset($params['uri'])){
            return "<?=preg_match('{$params['uri']}', \$_SERVER['REQUEST_URI'])?'active' : ''?>";
        }
        if(isset($params['uri_strong'])){
            return "<?= \$_SERVER['REQUEST_URI'] == '{$params['uri_strong']}' ? 'active' : '' ?>";
        }
        $parts = array();
        foreach($params as $key=>$val){
            $parts[] = "@\$_GET['$key'] == '$val'";
        }
        return "<?=(".join("&&", $parts).")?'{$active_class}':''?>";
    }
